{extend name="public::base" /}

{block name="content"}
<div class="col-md-8">
    <div class="page-header">
        <h2>用户注册</h2>
    </div>
    <form class="form-horizontal" id="login">
        <div class="form-group">
            <label for="inputEmail2" class="col-sm-2 control-label">邮箱：</label>
            <div class="col-sm-10">
                <input type="text" name="email" class="form-control" id="inputEmail2" placeholder="Email">
            </div>
        </div>
        <div class="form-group">
            <label for="inputPassword3" class="col-sm-2 control-label">密码：</label>
            <div class="col-sm-10">
                <input type="password" name="password" class="form-control" id="inputPassword3" placeholder="Password">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="button" class="btn btn-primary">登陆</button>
            </div>
        </div>
    </form>
</div>
{/block}

{block name="footer"}
<script type="text/javascript">
    $(function () {
        $('.btn-primary').on('click',function () {
            $.ajax({
                type:'post',
                url:"{:url('loginCheck')}",
//            url:"{:url('index/index/insert')}",
                dataType:'json',
                data:$('#login').serialize(),
                success:function (res) {
                    alert(res.message);
                    if(res.status == '1'){
                        location.href = "{:url('index/index/index')}";
                    }
                }
            });
        });
    });
</script>
{/block}